package UI.bll;

import javax.swing.*;
import java.text.SimpleDateFormat;
import java.util.Date;

public class runnableTime implements  Runnable{
    JLabel time;

    public runnableTime(JLabel Time) {
        this.time = Time;
    }

    public JLabel getTime() {
        return time;
    }

    @Override
    public void run() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
        while(true){

            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            getTime().setText(simpleDateFormat.format(new Date()));
        }
    }
}
